import React, { SFC } from 'react';
import commonInteractor from '../core/interactor/common';
import { useHistory, useLocation } from 'react-router-dom';
const Login: SFC = () => {
    const history = useHistory();
    const location = useLocation<{ form: { pathname: '/' } }>();
    const defaultState = { from: { pathname: '/' } };
    const { form } = location.state || defaultState;
    const singUp = () => {
        commonInteractor.authenticate(() => history.replace(form));
    };
    return (
        <div>
            <p>請登錄</p>
            <button onClick={singUp}>登錄</button>
        </div>
    );
};
export default Login;
